/**************************************************
* 创建作者：	咕咕咕
* 创建时间：	2020-12-14
* 作用描述：	#运算符符抽象
***************************************************/

namespace Utils.Calc
{
	public abstract class Operator
	{
		#region ----字段----
		private const string include	= "+-*/÷x^√(";
		#endregion

		#region ----属性----
		public abstract byte Priority { get; }
		public abstract bool TwoOperand { get; }
		public abstract bool Praevia { get; }
		#endregion

		#region ----公有方法----
		public virtual double Calculate(double n1, double n2) => n2 + n1;

		public virtual double Calculate(double n) => n;
		#endregion

		#region ----静态方法----
		public static bool IsOperator(char c) => include.IndexOf(c) != -1;
		#endregion
	}
}